import request from '@/utils/request'

/* 列表分页*/
export function selectSaleOrderPage(data) {
  return request({
    url: '/erp/saleOrder/selectSaleOrderPage',
    method: 'post',
    data: data
  })
}

/* 列表分页*/
export function selectSaleOrderByOrderNo(data) {
  return request({
    url: '/erp/saleOrder/selectSaleOrderByOrderNo',
    method: 'post',
    data: data
  })
}

/* 新增*/
export function saveSaleOrder(data) {
  return request({
    url: '/erp/saleOrder/saveSaleOrder',
    method: 'post',
    data: data
  })
}

/* 修改*/
export function updateSaleOrderById(data) {
  return request({
    url: '/erp/saleOrder/updateSaleOrderById',
    method: 'post',
    data: data
  })
}

/* 删除*/
export function deleteSaleOrder(data) {
  return request({
    url: '/erp/saleOrder/deleteSaleOrder',
    method: 'post',
    data: data
  })
}

/* 取消 */
export function cancelOrder(orderId) {
  return request({
    url: '/erp/saleOrder/cancel/' + orderId,
    method: 'post'
  })
}

/* 根据订单id查询订单详情 */
export function selectSaleOrderById(orderId) {
  return request({
    url: '/erp/saleOrder/selectSaleOrderById/' + orderId,
    method: 'post'
  })
}

/* 生成订单产品信息 */
export function generateOrder(data) {
  return request({
    url: '/erp/saleOrder/generateOrder',
    method: 'post',
    data: data
  })
}

/* 利润计算 */
export function profitCalculation(data) {
  return request({
    url: '/erp/saleOrder/profitCalculation/' + data,
    method: 'post'
  })
}

/* 查询订单状态数量 */
export function selectOrderStateCount(data) {
  return request({
    url: '/erp/saleOrder/selectOrderStateCount',
    method: 'post',
    data: data
  })
}

/* 终止订单 */
export function terminationOrder(data) {
  return request({
    url: '/erp/saleOrder/termination',
    method: 'post',
    data: data
  })
}

/* 订单外发 */
export function outsourcingOrderById(data) {
  return request({
    url: '/erp/saleOrder/outsourcingOrderById',
    method: 'post',
    data: data
  })
}
